package com.security.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class UrlController {
    @RequestMapping("/who")
    @ResponseBody
    public Object who(){
        return SecurityContextHolder.getContext().getAuthentication();
    }

    @GetMapping("/loginPage")
    public String login(){
        return "loginPage";
    }

    @GetMapping("/failPage")
    public String fail(){
        return "fail";
    }

    @PostMapping("/successPage")
    public String success(){
        return "success";
    }

    @GetMapping("/test")
    public String test(){
        return "test";
    }
}
